<?php

require_once('functions/pageLoad.php');
$page_title = 'Free online quotes from local tradesmen!';

// load trades

$sql = "SELECT trade, url FROM trades ORDER BY trade";
$query=mysql_query( $sql ) or die ("Error in query: $sql . " . mysql_error());
$rows = mysql_num_rows($query);

$max_per_column = ceil($rows / 4);

$col_2_start = $max_per_column + 1;
$col_2_end = $max_per_column * 2;

$col_3_start = ($max_per_column * 2) + 1;
$col_3_end = $max_per_column * 3;

$col_4_start = ($max_per_column * 3) + 1;

$i = 1;

while($trades_rs=mysql_fetch_assoc($query)){

$trades_cols.=($i == 1 || $i == $col_2_start || $i == $col_3_start)? '<ul>'."\r\n" : '' ;

$trades_cols.=($i == $col_4_start) ? '<ul style="border-right: none;">'."\r\n" : '' ;

$trades_cols.='<li><a href="/tradesmen/'.$trades_rs['url'].'/all-areas" title="Local '.htmlentities($trades_rs['trade']).'">'.htmlentities($trades_rs['trade']).'</a></li>'."\r\n";

$trades_cols.=($i == $max_per_column || $i == $col_2_end || $i == $col_3_end || $i == $rows)? '</ul>'."\r\n" : '' ;

$i++;

}


$content='
<h2 id="welcome_header">Welcome to your new home for competitive online quotes!</h2>

<img src="/images/process.jpg" alt="" style="margin: 0px 0px 0px 13px; display: inline;" usemap="#process" />

<map name="process" id="process">
<area shape="rect" coords="0,25,164,150" href="/post-a-job" alt="Post your job" title="Post your job" />
<area shape="rect" coords="0,150,115,183" href="/post-a-job" alt="Post your job" title="Post your job" />
</map>

<div class="page_left">

<p><strong>Can\'t find an electrician or plumber?</strong></p>
<p><strong>Don\'t know any good builders?</strong></p>
<p><strong>No unwanted phone calls or visitors!</strong></p>
<p><strong>Simply <a href="/post-a-job">post your job</a> on our system, it\'s that easy!</strong></p>
<p><strong>For more details visit our <a href="/help">help</a> pages.</strong></p>

</div>

<div class="page_right">
<h2 id="process_header">It\'s quick and easy!</h2>
<p>Only at <strong>I Want A Tradesman</strong> will you find competitive quotes from <strong>local tradesmen</strong> in your area.</p>
<p>We take the time to ensure we find relevant trades within your area. That way you will receive several quotes on your jobs.</p>
<a href="/help" id="find_out_more_button" class="light_blue_button" title="Find out more!">Find out more!</a> <a href="/post-a-job" id="get_a_quote_button" class="light_blue_button" title="Get a quote!">Get a quote!</a>
</div>

<div class="divider"><hr /></div>

<h2 id="find_a_tradesman_header">Find a tradesman</h2>

<div id="threecol_list">

'.$trades_cols.'

</div>


';

include('includes/meta.php');
include('includes/header.php');
include('includes/navigation.php');

?>

<h1 id="bigWhiteHeader">Free online quotes from local tradesmen!</h1>

<div id="leftColumn">
<?php
$banner_area_type = 'visitor_area';
echo get_banner_ad('content_banner', $banner_area_type);
?>

<?php
echo $content;
?>

</div>

<?php 

include('includes/rightColumn.php');
include('includes/footer.php');

?>